
local BuyCtrl={}

function BuyCtrl:init()
    NetEngine:registerCallback(ProtoCmd.ResBuyGoodsMessage,function(msg)
        print("ResBuyGoodsMessage")
        DyTransportPack:calCartItems()
        FzEventCenter:DispichEvent(FzEvent.ReloadTradeingInfo)
        FzEventCenter:DispichEvent(FzEvent.UpdateTradeCoins)
    end)
    NetEngine:registerCallback(ProtoCmd.ResSellGoodsMessage,function(msg)
        print("ResSellGoodsMessage")
        DyTransportPack:clearRecycleItems("dosell")
        FzEventCenter:DispichEvent(FzEvent.ReloadTradeingInfo)
        FzEventCenter:DispichEvent(FzEvent.UpdateTradeCoins)
    end)
    NetEngine:registerCallback(ProtoCmd.ResCityInfoMessage,function(msg)
        print("ResCityInfoMessage")
        DyTradeStore:setGoodsStore(msg.param)
    end)
end

function BuyCtrl:clean()
    NetEngine:unregisterCallback(ProtoCmd.ResBuyGoodsMessage)
    NetEngine:unregisterCallback(ProtoCmd.ResSellGoodsMessage)
    NetEngine:unregisterCallback(ProtoCmd.ResCityInfoMessage)
end

return BuyCtrl